<template>
  <div>
    <input type="text" @input="chazhao" v-model="val" />
    <ul>
      <li v-for="item in arrNew" :key="item">
        {{ item }}
      </li>
    </ul>
  </div>
</template>
<style scoped>
</style>
<script>
export default {
  data() {
    return {
      arr: ["阿迪鞋子", "耐克鞋子", "鸿星尔克鞋子", "李宁鞋子"],
      val: "",
      arrNew: [],
    };
  },
  methods: {
    chazhao() {
      (this.arrNew = []),
        this.arr.forEach((item) => {
          if (this.val) {
            if (item.indexOf(this.val) != -1) {
              this.arrNew.push(item);
            }
          }
        });
    },
  },
};
</script>